<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib uri="/struts-tags" prefix="s"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OA协同办公系统</title>
<link type="text/css" rel="stylesheet" href="css/table.css">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/openwindow.js"></script>
<script type="text/javascript" src="js/file.js"></script>
<script type="text/javascript" src="js/flow.js"></script>
<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<style type="text/css">
		body,td,th {
			background-color:white;
			font-family: "宋体";
			font-size: 12px;
		}
		.sendtd{border-bottom:#F00 double 1px}
		.ztable{margin:15px 0 15px 0}
		</style>
	<script type="text/javascript">
	function saveText(val){
		$("#contentid").val(val);
	}
	
	function update(){
		var url="updateSysDocument.action";
		var table=$("#filetable").find("input[type=\"checkbox\"]");
		var fileId="";
		for(var i=0;i<table.length;i++){
			fileId+="_"+table[i].value;
		}
		$("#fileArray").val(fileId);
		var textIds=$("#zhengwentable").find("input[type=\"checkbox\"]");
		var idArr="";
		for(var i=0;i<textIds.length;i++){
				idArr+="_"+textIds[i].value;
			}
		$("#textId").val(idArr);
		$.post(url,$("form").serialize(),function(data){
			if(data=="success"){
				alert("操作成功");
			window.close();
				var currentPage=$("#currentPage").val();
				window.opener.page(currentPage);
			}else{
				alert("操作失败");
			}
		});
	}
	
	function topChange(val){
	if(val!=''){
	var font2=$("#postFont2").val();
	var param={"name":val,"department":font2,"status":"1"};
	$.post("getDispatcherTopShort.action",param,function(data){
		var shortName=data.shortName;
		var maxTop=data.maxTop;
		$("#postFont1").val(shortName);
		$("#postFont3").val(maxTop);
	},"json");
	}
}
function topChangeDate(val){
	if(val!=''){
	var wt=$("#wt").val();
	var param={"name":wt,"department":val,"status":"1"};
	$.post("getDispatcherTopShort.action",param,function(data){
		var maxTop=data.maxTop;
		$("#postFont3").val(maxTop);
	},"json");
	}
}

function typeChange(val){
	if(val!=''){
	var font2=$("#postFont2").val();
	$("#postFont1").val(val);
	var param={"name":val,"department":font2,"status":"2"};
	$.post("getReceiveType.action",param,function(data){
		var maxTop=data.maxTop;
		$("#postFont3").val(maxTop);
	},"json");
	}
}


function typeChangeDate(val){
	if(val!=''){
	var lx=$("#lx").val();
	var param={"name":lx,"department":val,"status":"2"};
	$.post("getReceiveType.action",param,function(data){
		var maxTop=data.maxTop;
		$("#postFont3").val(maxTop);
	},"json");
	}
}
</script>
  </head>
  
<body onload="getFiles('zhengwentable','textId');getFiles('filetable','fileArray');">
<input type="hidden" id="currentPage" value="${currentPage}">
<form action="" method="post" name="documentForm" >
<div id="nodebutton" align="center">
	<input class="button_04"   type="button" onclick="update();"  value="保存" />&nbsp;
	</div>
	<div align="center"><h1 align="center"style="font-weight:bold">${document.flowName}</h1></div>
<input type="hidden" name="document.textId" id="textId" value="${document.textId}">
<input type="hidden" name="document.fileArray" id="fileArray" value="${document.fileArray}">
<input type="hidden" name="document.id" value="${document.id}">
<input type="hidden" name="document.draftOrg" value="${document.draftOrg}">
<input type="hidden" name="document.draftUser" value="${document.draftUser}">
<input type="hidden" name="document.draftName" value="${document.draftName}">
<input type="hidden" name="document.draftStaus" value="${document.draftStaus}">
<input type="hidden" name="document.flowId" value="${document.flowId}">
<input type="hidden" id="contentid" name="document.contentId" value="${document.contentId}">
<input type="hidden" name="document.sfstatus" value="${document.sfstatus}">
<table align="center" border="0" cellspacing="1" cellpadding="0" width="57%">
<tr>
<td width="60px">正文：</td>
<td colspan="7">&nbsp;<input type="button" class="button_04" id="zwsc"   onclick="file_upload('zhengwentable')" value="上传附件"/> <input type="button" class="button_02"  onclick="fileDel('zhengwentable')"  value="删除"/>
	<table id="zhengwentable">
	
	</table></td>
</tr>
<tr>
<td width="60px">附件：</td>
<td colspan="7">&nbsp;<input type="button" class="button_04" id="fjsc"  onclick="file_upload('filetable')" value="上传附件"/> <input type="button" class="button_02"  onclick="fileDel('filetable')"  value="删除"/>
	<table id="filetable">
	</table></td>
</tr>
</table>
<table align="center" style="margin-top:10px; background:#000" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td width="60px">类型：</td>
    <td colspan="7"><s:select id="lx" onchange="typeChange(this.value)"  list="departments" listKey="name" listValue="name" name="document.type" value="document.type" theme="simple" headerKey="" headerValue="--请选择--" cssStyle="width:200px"></s:select></td>
  </tr>
  <tr>
    <td width="60px">编号：</td>
    <td width="230px">
     <span id="fwzh" >
       <input id="postFont1"  type="text" name="document.postFont1" value="${document.postFont1}"  style="width:100px;" maxlength="20"/>
        <s:select id="postFont2"  onchange="typeChangeDate(this.value)" list="#{'[2007]':'2007','[2008]':'2008','[2009]':'2009','[2010]':'2010','[2011]':'2011','[2012]':'2012','[2013]':'2013','[2014]':'2014','[2015]':'2015','[2016]':'2016','[2017]':'2017','[2018]':'2018','[2019]':'2019','[2020]':'2020'}"  name="document.postFont2" headerKey="" headerValue="" value="document.postFont2" theme="simple"></s:select>
        <input  id="postFont3"  type="text" name="document.postFont3" value="${document.postFont3}"  style="width:50px;" maxlength="20"/>
        </span>
    </td>
    <td width="70px">来文单位：</td>
    <td colspan="3"  width="200px"><input id="lwdw"  value="${document.fromDept}" maxlength="50"  type="text" style="width:180px;" name="document.fromDept"/>
    <font style="font-weight:bold"  color="#FF0000">*</font></td>
    <td width="67px">文号：</td>
    <td ><input id="wh"  value="${document.articleNumber}" maxlength="50"   type="text"  style="width:150px;" name="document.articleNumber" /></td>
  </tr>
  <tr>
    <td>标题：</td>
    <td colspan="7" ><input id="bt" value="${document.title}"  id="bt" maxlength="80" type="text" style="width:97%;" name="document.title"/><font style="font-weight:bold"  color="#FF0000">*</font></td>
  </tr>
  <tr>
    <td>密级：</td>
    <td><s:select id="mj" cssStyle="width:100px"  list="#{'秘密':'秘密','机密':'机密','绝密':'绝密'}" name="document.mjStatu" value="document.mjStatu" theme="simple" headerKey="" headerValue=""></s:select></td>
    <td>份数：</td>
    <td width="63"><input id="fs" maxlength="10" type="text" style="width:50px;" name="document.print" value="${document.print}"/></td>
    <td width="64">缓急程度：</td>
    <td width="79"><s:select id="hjcd"  list="#{'加急':'加急','特急':'特急','特提':'特提'}" name="document.hjStatu" value="document.hjStatu" theme="simple" headerKey="" headerValue=""></s:select></td>
    <td>来文日期：</td>
    <td><input  id="lwrq" name="document.printTime" onclick="WdatePicker()" value="${document.printTime}" class="Wdate" type="text" ></td>
  </tr>
  <tr>
    <td height="100" align="center">
       <p>&nbsp;</p>
    	拟<br><br>
    	办<br><br>
         意<br><br>
    	见
   	 <p>&nbsp;</p>
    </td>
    <td colspan="7">
    <p>&nbsp;</p>
    ${document.nbyj}
    <textarea id="nbyj" disabled="disabled" name="document.nbyj" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
    <td height="100" align="center">
     <p>&nbsp;</p>
        部<br><br>
        门<br><br>
        负<br><br>
        责<br><br>
        人<br><br>
        意<br><br>
        见
      <p>&nbsp;</p>
    </td>
    <td colspan="7">
    <p>&nbsp;</p>
    ${document.dcdb}
    <textarea id="dcdb" disabled="disabled" name="document.dcdb" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
   <tr>
    <td height="100" align="center">
    <p>&nbsp;</p>
        局<br><br>
        领<br><br>
        导<br><br>
        批<br><br>
        示
     <p>&nbsp;</p>
    </td>
    <td colspan="7">
    <p>&nbsp;</p>
    ${document.ldps}
    <textarea id="ldps" disabled="disabled" name="document.ldps" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
    <td height="100" align="center">
      <p>&nbsp;</p>
        办<br><br>
        理<br><br>
        情<br><br>
        况
     <p>&nbsp;</p>
    </td>
    <td colspan="7">
    <p>&nbsp;</p>
    ${document.blqk }
    <textarea id="blqk" disabled="disabled" name="document.blqk" style=" width:500px; height:120px; border:0; overflow:hidden"></textarea>
    </td>
  </tr>
  <tr>
    <td height="80" align="center">
      <p>&nbsp;</p>
         备<br><br>
         注
     <p>&nbsp;</p>
   </td>
    <td colspan="7">
    <textarea id="bz" disabled="disabled" name="document.beizhu" style=" width:500px; height:120px; border:0; overflow:hidden">${document.beizhu }</textarea>
    </td>
  </tr>
	<input type="hidden" name="document.supervision" value="${document.supervision }">
</table>
</form>
<table style="border: 1px solid;color: #ffffff;" align="center" width="80%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999" >
		<c:forEach items="${hisList}"  var="his">
		<tr>
		<td style="background: #ffffff;" width="10%">${his.userName}</td>
		<td style="background:#ffffff" >${his.content}</td>
		<td style="background:#ffffff" width="18%"> <fmt:formatDate value="${his.updateTime}" type="both"/></td>
		</tr>
		</c:forEach>
	</table>
</body>
</html>